package com.woniu.gf.pawn.comm.core.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @BelongsProject: gf-pawn-comm
 * @BelongsPackage: com.woniu.gf.pawn.comm.core.dto
 * @Author: wu wei
 * @CreateTime: 2020-10-08 20:30
 * @Description:
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultDto {
    /**
     * 信息返回成功失败
     */
    private boolean success;
    private Integer code;
    private String message;
    private Object data;


    public ResultDto(boolean success) {
        this.success = success;
    }

    public ResultDto(boolean success, Integer code, String message) {
        this.success = success;
        this.code = code;
        this.message = message;
    }



    public static ResultDto success() {
        return new ResultDto(true);
    }

    public static ResultDto success(Integer code, String message) {
        return new ResultDto(true, code, message);
    }

    public static ResultDto success(Integer code, String message, Object object) {
        return new ResultDto(true, code, message, object);
    }

    public static ResultDto fail(Integer code, String message) {
        return new ResultDto(false, code, message);
    }

    public static ResultDto fail() {
        return new ResultDto(false);
    }

    public static ResultDto fail(Integer code, String message, Object object) {
        return new ResultDto(true, code, message, object);
    }
}
